package com.dw.love.dwade.view.fragment;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.dw.love.dwade.R;
import com.dw.love.dwade.data.ImageWade;
import cn.bmob.v3.BmobQuery;


/**
 * Created by luozizhao on 2018/6/14.
 */

public class FragmentHomeNews extends Fragment {

    private static final String TAG = "FragmentHomeNews";

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home_news, null);
        initData();
        return view;
    }

    private void initData() {

        BmobQuery<ImageWade> query = new BmobQuery<ImageWade>();

        //查询单条
/*        query.getObject("EHwL888B", new QueryListener<ImageWade>() {
            @Override
            public void done(ImageWade imagewade, BmobException e) {
                if(e==null){
                    ToastUtils.showShort("查询成功");
                }else{
                    ToastUtils.showShort("查询失败：" + e.getMessage());
                    Log.d(TAG, "done: e.getMessage():"+e.getMessage()+",code:"+e.getErrorCode());
                }
            }
        });*/


        // 多条查询
       /* query.addQueryKeys("objectId,name,icon,descripe");
        query.findObjects(new FindListener<ImageWade>() {
            @Override
            public void done(List<ImageWade> list, BmobException e) {
                if (e == null) {
                    ToastUtils.showShort("查询成功");
                    for (ImageWade l : list) {
                        Log.d(TAG, "done: "+l.toString());
                    }
                } else {
                    ToastUtils.showShort("查询失败：" + e.getMessage());

                }
            }
        });*/

    }


}
